// SETUP

#include endepisodegraphics_other.txt

// HELPER FUNCTIONS	

function signanimate(sign) {
	var s = sign.show("turn");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	sign.show("loop");
}

function spinthewheel(sign, wheel) {
  var s = sign.show("turn");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	sign.hide();
	
  wheel.x = 30;
  wheel.y = -30;
  play("spinthewheel");
	var s = wheel.show("spin1");
	//s.onComplete(function() { resume(); sign.show("loop"); });
	//pause();
	while(!s.completed) {
		// do nothing
	}
	wheel.hide();
}

// ACTORS

actor("Baby Squid", screenwidthmid + 400, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
actor("Warrior", 150, screenheight - 100, Col.LIGHTBLUE, LEFT, BOTTOM, "chat_warrior", "characters/warrior/charicon_warrior");

// INTRO

play("music_cutscene_lesscheery");

changebackground("intro_sign");

sign.y = -screenheight;
babysquid.y = -screenheight;
sign.show("loop");
babysquid.show("idle");

Actuate.tween(sign, 2, { y: 0 }).ease(Expo.easeOut);
Actuate.tween(babysquid, 2, { y: 0 }).ease(Expo.easeOut);

wait(0.5);

fadein();

wait(1.5);

babysquid.show("talking");
speak("Baby Squid", "Aaaah! Hello again!|That was great!");
babysquid.show("worriedtalking");
actor("Baby Squid", screenwidthmid + 200, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "Anyway I got it wrong last time and I’m|meant to tell you to spin the wheel...");
actor("Baby Squid", screenwidthmid, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "...and also tell you that it’s DEFINITELY possible|that you might win and it’s not rigged at all!");
babysquid.show("worriedidle");

babysquid.hide();

spinthewheel(sign, wheel);

signanimate(sign);

babysquid.show("worriedtalking");
actor("Baby Squid", screenwidthmid + 400, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "Okay now I’m meant to say:");
actor("Baby Squid", screenwidthmid, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "'I’m so sorry, not this time, but we’re excited|to see you soon for more Dicey Dungeons.'");
babysquid.show("talking");
actor("Baby Squid", screenwidthmid + 100, 100, 0xfda8ff, LEFT, TOP, "chat_monster1");
speak("Baby Squid", "Oh wow, that’s even true! I AM excited|to see you soon!");
babysquid.show("idle");

gamecompletefromcutscene();
